package controller;


import domain.Employee;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import service.IEmployeeService;

import javax.annotation.Resource;
import java.util.List;

@Controller
public class EmployeeController{
    @Resource(name="employeeService")
    private IEmployeeService employeeService;
    /* 员工档案查询 */
    @RequestMapping("/employeeAction")
    public ModelAndView findEmployee(Employee employee) {
        ModelAndView modelAndView;
        List<Employee> employees = employeeService.findEmployee(employee);
        if(employees!=null){
            modelAndView=new ModelAndView("/employee");
            modelAndView.addObject("employees", employees) ;
        }else{
            modelAndView=new ModelAndView("forward:/cs.jsp");
        }
        return modelAndView;
    }
}
